import request from "./request";
import _data from "./_data";

export default {
	login(data){
		return request.post('/auth/login',data);
	},
	getVerificationCode(){
		return request.get('/common/auth/verification_code');
	},
    groupState(param) {
        return request.post('/onmessage/group/getState', param);
    },
    getChatData(config) {
        request.post('/onmessage/onmessage/getChatData', config.data).then(res => {
            let data = res.data;
            if (config.is_action_data) {
                uni.$emit('data_chat_data', data);
                _data.localData(data.chat_id, data);
            } else {
                uni.$emit('data_chat_data_unshift', data.list);
            }
            if ('callback' in config) {
                config.callback(data);
            }
        });
    }
}
